package com.lcxw.hxzbapi.controller.paycontroller;

import com.lcxw.hxzbapi.entity.pojo.YwpdChargeDetail;
import com.lcxw.hxzbapi.entity.requestBean.GetMyPayRecordReq;
import com.lcxw.hxzbapi.entity.requestBean.RequestParamBasic;
import com.lcxw.hxzbapi.entity.response.Response;
import com.lcxw.hxzbapi.service.YwpdChargeDetailService;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/pay")
public class PayController {

    @Resource
    YwpdChargeDetailService chargeDetailService;

    @PostMapping("/records/get/mine")
    public Response getMyPayRecords(@RequestBody GetMyPayRecordReq requestBody) {
        long userId = Long.parseLong(requestBody.getUserId());
        int pageNum = requestBody.getPageNum();
        int pageSize = requestBody.getPageSize();
        pageNum = (pageNum - 1) * pageSize;
        List<YwpdChargeDetail> ywpdChargeDetails = chargeDetailService
            .selectByUserId(userId, pageNum, pageSize);
        return Response.ok(ywpdChargeDetails);

    }

}
